package com.itgan.userbackendmanagement.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;  
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
//@Configuration  注解springboot启动时会扫描该配置类
@Slf4j
public class WebConfig implements WebMvcConfigurer {  
  
    @Override  
    public void addCorsMappings(CorsRegistry registry) {
        log.info("配置类启动了");
        registry.addMapping("/**")  
            .allowedOrigins("http://localhost:8000")  
            .allowedMethods("GET", "POST", "PUT", "DELETE")  
            .allowedHeaders("*")  
            .allowCredentials(true);  
    }  
}